home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
FONTEDIT.ZIP
/
FONTEDK.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-12-23
|
4KB
|
194 lines
{A BUNCH OF SLAP HAPPY CODING TO GET IT TO WORK ANY WAY RUSHED JOB 20.12.95}
Uses Mcga,Crt;
Const
Open : Boolean = False;
PenOn : Boolean = True;
Var
Grid : Array[1..16,1..16] Of Byte;
X,Y,Z,col,start : Byte;
Xpos,Ypos : Byte;
Block : String[1];
ch : Char;
F : Text;
Procedure SetGrid;
Begin
For X := 1 To 16 Do
For Y := 1 To 16 Do
Begin
TextColor(15); Gotoxy(X,Y);
If Grid[X,Y] = 0 Then Write('+') Else Begin
TextColor(Grid[X,Y]); Write('█'); end;
end;
Col := 1; GotoXy(Xpos,Ypos);
end;
Procedure WriteIt;
Begin
Write(Block);
Grid[Xpos,Ypos] := Col;
end;
Procedure Down;
Begin
Inc(Ypos);
Gotoxy(Xpos,Ypos);
If PenOn Then WriteIt;
end;
Procedure Up;
Begin
Dec(Ypos);
Gotoxy(Xpos,Ypos);
If PenOn Then WriteIt;
end;
Procedure Left;
Begin
Dec(Xpos);
Gotoxy(Xpos,Ypos);
If PenOn Then WriteIt;
end;
Procedure Right;
Begin
Inc(Xpos);
Gotoxy(Xpos,Ypos);
If PenOn Then WriteIt;
end;
Procedure SaveIt;
Begin
If Not Open Then Assign(F,ParamStr(1));
If Not Open Then Rewrite(F);
Open := True;
Writeln(F,'Const E : Array[1..16,1..16] Of Byte =');
For Y := 1 To 16 Do Begin
For X := 1 To 16 Do Begin
If (Z = 1) And (Start = 1) Then Write(F,'((',Grid[X,Y],',') else
If Z = 1 Then Write(F,'(',Grid[X,Y],',') else
If (Z = 16) Then Write(F,Grid[X,Y],'),') else
Write(F,Grid[X,Y],',');
Inc(Start);
Inc(Z);
If Z = 17 Then
Begin
Z := 1;
Writeln(f);
end;
end;
end;
Writeln(F);
Start := 1;
end;
Procedure Show;
Begin
Gmode;
For Y := 1 To 16 Do
For X := 1 To 16 Do
If Grid[X,Y] <> 0 then PutPixel(X,Y,Grid[X,Y],VGA);
Readkey;
Tmode;
SetGrid;
end;
Procedure Help;
Begin
TextColor(15);
Gotoxy(20,12); Write('Number 1 To 8 Change Color 0 = Reset');
Gotoxy(20,11); Write('ENTER Show Graphical Font (Pallette Not Set');
Gotoxy(20,13); Write('Use Cursors To Move Pointer');
Gotoxy(20,14); Write('Space PenUp Or PenDown');
TextColor(Col);
end;
Procedure NewFont;
Begin
SaveIt;
For X := 1 To 16 Do
For Y := 1 To 16 Do
Grid[X,Y] := 0;
TextColor(15);
Gotoxy(1,1); Xpos := 1; Ypos := 1;
SetGrid;
end;
Begin
Start := 1; Xpos := 1; Ypos := 1; Block := '█';
If ParamCount < 1 Then
Begin
Writeln('Please Specify A Filename To Save To');
Writeln('e.g Fonted C:\A.Fnt');
Halt;
end;
ClrScr;
Writeln('Font Editor By Darius Sutherland Crucial D');
Writeln('Very Basic But Can Produce 16x16 Fonts');
Writeln('Fonts Depend On Creative Skill');
Writeln;
Writeln('Press Q Any Time For Help');
Readkey;
Clrscr;
Z := 1;
For X := 1 To 16 Do
For Y := 1 To 16 Do
Grid[X,Y] := 0;
SetGrid;
Gotoxy(Xpos,Ypos);
TextColor(Col);
REPEAT
Ch := Readkey;
If Ch = '1' Then Col := 1;
If Ch = '2' Then Col := 2;
If Ch = '3' Then Col := 3;
If Ch = '4' Then col := 4;
If Ch = '5' Then Col := 5;
If Ch = '6' Then Col := 6;
If Ch = '7' Then Col := 7;
If Ch = '8' Then Col := 8;
If Ch = '0' Then Col := 0;
If (Ch = 'Q') Or (Ch = 'q') Then Help;
If Col = 0 Then Block := '+' else Block := '█';
If (Ch = #80) And (Ypos < 16) Then Down;
If (Ch = #72) And (Ypos > 1) Then Up;
If (Ch = #75) And (Xpos > 1) then Left;
If (Ch = #77) And (Xpos < 16) Then Right;
If (Ch = 'n') Or (Ch = 'N') Then NewFont;
If Ch = #13 Then Show;
If Ch = #32 Then
Begin
PenOn := Not PenOn;
end;
If Col = 0 Then TextColor(15) else TextColor(Col);
UNTIL Ch = #27;
SaveIt;
If Open Then Close(f);
TextColor(15);
TextBackGround(0);
Clrscr;
Writeln('Font Editor By Darius Sutherland Crucial D');
Writeln('All Fonts Save To File');
Writeln;
Writeln('18.12.95');
end.